package com.allen.flink.batch;

import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple3;

/**
 * 功能: 数据去重
 *
 * @date: 2020-03-24 13:05
 * @author: Allen
 * @version: 0.0.4-snapshot
 * @Email: allenZyhang@163.com
 * @since: JDK 1.8
 **/
public class Distinct {
    
    public static void main(String[] args) throws Exception {
        //获取执行环境
        final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        
        //读取数据源
        DataSet<Tuple3<Long, String, Integer>> ds = env.fromElements(Tuple3.of(1L, "Mars", 28), Tuple3.of(2L, "Mark", 24), Tuple3.of(2L, "Mark", 24), Tuple3.of(3L, "Alex", 19),
            Tuple3.of(3L, "Mary", 22));
        ds.distinct(0).print();
        
    }
}
